home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus Special 18
/
AMIGAplus Sonderheft 18 (1999)(ICP)(DE)[!].iso
/
PD
/
Spiele
/
InvasionForce
/
Source
/
Misc
/
MakeSource.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1999-01-08
|
963b
|
43 lines
/*
MakeSource.rexx
convert a binary data file into C source suitable for
compiling directly into my program
*/
parse arg filename
if ~open('infile',filename,'r') then do
say "Sorry, can't read" filename "."
exit
end
call open('outfile',"T:OUTPUT",'w')
call open('console','*','w')
count=0;
call writech('outfile',' ')
datum=readch('infile',2)
say "Working..."
call writech('console','')
do while ~eof('infile')
if (count>0) then call writech('outfile',',')
if (count//16==0 & count>0) then do
call writeln('outfile','')
call writech('outfile',' ')
call writech('console',' ')
end
mystring='0x'||C2X(datum)
call writech('outfile',mystring)
count=count+2
datum=readch('infile',2)
end
call close('infile')
call close('outfile')
call close('console')
say ''
address command "copy T:OUTPUT to" filename'.CX'
address command "delete >nil: T:OUTPUT"
exit
/* end of listing */